package com.wish.g04.financing.controller;


import com.wish.g04.common.core.web.controller.BaseController;
import com.wish.g04.common.core.web.domain.AjaxResult;
import com.wish.g04.common.core.web.page.TableDataInfo;
import com.wish.g04.financing.dto.ReceiptPlanDTO;
import com.wish.g04.financing.service.ReceiptPlanService;
import com.wish.g04.financing.vo.ReceiptPlanVO;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;


/**
 * 收款计划
 * @author tianyandong
 */
@RestController
@RequestMapping("/receipt_plan")
public class ReceiptPlanController extends BaseController {

    @Autowired
    private ReceiptPlanService receiptPlanService;

    /**
     * 查询所有收款计划
     * @param receiptPlanDTO
     * @return
     */
    @GetMapping("getReceiptPlanList")
    public AjaxResult getReceiptPlanList(ReceiptPlanDTO receiptPlanDTO) {
        startPage();
        //查询所有收款计划
        List<ReceiptPlanVO> receiptPlanVOList = receiptPlanService.getReceiptPlanList(receiptPlanDTO);
        //查询所有收款计划
        ReceiptPlanVO receiptPlanVO = receiptPlanService.getReceiptPlanSum(receiptPlanDTO);
        TableDataInfo dataTable = getDataTable(receiptPlanVOList);
        HashMap<String, Object> map = new HashMap<>();
        map.put("receiptPlanVOList",dataTable);
        map.put("receiptPlanVO",receiptPlanVO);
        return AjaxResult.success(map);
    }



}
